<%-- 
    Document   : RegistroEntregas
    Created on : 02/06/2011, 09:33:12 PM
    Author     : Alejandro
--%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %> 
<%@ page import="data.BitacoraDataMapper" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="arivp89.css" media="screen" />
        <title>Registro de Entregas</title>
    </head>
    <body>
        <html:form action="/RegistroEntregas" method="post" >
            <h1>Listado de entregas</h1><br>
            <table border="1" cellspacing="3" cellpadding="2">
                <thead>
                    <tr>
                        <th>Codigo</th>
                        <th>Nombre</th>
                        <th>Fecha</th>
                        <th>Nota</th>
                        <th>Comentarios</th>
                        <th>Nombre de archivo</th>
                        <th>Integrantes</th>
                    </tr>
                </thead>
                <tbody>
                    <%
                    BitacoraDataMapper mapper = new BitacoraDataMapper();
                    ResultSet rs = mapper.obtenerListadoEntregas(request.getSession().getAttribute("BitID").toString());
                    if(rs!=null){
                        while(rs.next()){
                                out.println("<tr>");
                                out.println("<td>"+rs.getString(1) +"</td>");
                                out.println("<td>"+rs.getString(2) +"</td>");
                                out.println("<td>"+rs.getString(3) +"</td>");
                                out.println("<td>"+rs.getString(4) +"</td>");
                                out.println("<td>"+rs.getString(5) +"</td>");
                                out.println("<td>"+rs.getString(6) +"</td>");
                                out.println("<td>"+mapper.obtenerStringIntegrantes(rs.getString(1)) +"</td>");
                                out.println("</tr>");
                        }
                    }
                    %>
                </tbody>
            </table><br><br>
            Si desea descargar un archivo, seleccione el codigo de la entrega:<br>
            <select name="codigo" size="1">  
            <%  
            rs = mapper.obtenerCodigosEntrega(request.getSession().getAttribute("BitID").toString());
            String opcion;
            try   
            {  
               while(rs.next()){   
                    opcion = rs.getString(1);    
            %>  
                <option value=<%=opcion%>><%=opcion%></option>  
            <%   
               }  
            }  
            catch(Exception e)  
            {  
              out.println(e);  
            }  
            %>   <br>
            </select> 
            <html:submit>Descargar</html:submit>
        </html:form>
        <br><br>
        <html:link page="/AgregarEntrega.jsp">Agregar entrega</html:link><br><br><br>
        <html:link page="/ModificarBitacoraIndex.jsp"><- Atrás</html:link>
        <div id="bottom">
            Creado por: Alejandro Rivera, Franklin Alfaro. ECCI, UCR.
            <br>
        </div>
    </body>
</html>
